<?php
/**
 * @copyright  For copyright and license information, read the COPYING.txt file.
 * @link       /COPYING.txt
 * @license    Academic Free License (AFL 3.0)
 * @package     default_default
 */

/** @var Mage_Adminhtml_Block_Page_Header $this */
?>
<div class="header-top">
    <a href="<?php echo $this->getHomeLink() ?>" class="logo" title="<?php echo $this->__('OpenMage ver. %s', Mage::getOpenMageVersion()) ?>">
        <svg version="1.1" id="magentologo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="40px" viewBox="0 0 20 40" enable-background="new 0 0 20 40" xml:space="preserve">
            <path fill="#FFFFFF" d="M12.9,23.4V30H7.5v-6.3c0-1,0.3-1.8,0.8-2.3c0.5-0.5,1.2-0.8,2-0.8c0.8,0,1.5,0.2,1.9,0.7 C12.7,21.8,12.9,22.5,12.9,23.4z M3.8,21.3c-0.5-0.5-1.1-0.7-1.9-0.7c-0.8,0-1.4,0.2-1.9,0.7V30h4.5v-6.6 C4.5,22.5,4.3,21.8,3.8,21.3z M16.2,10H0v9.1c0.2-0.2,0.4-0.4,0.6-0.5C1.3,18.2,2.1,18,3,18c1,0,1.8,0.2,2.5,0.7 c0.7,0.5,1.2,1.1,1.6,2c0.4-0.8,0.9-1.5,1.7-1.9c0.7-0.5,1.6-0.7,2.5-0.7c1.4,0,2.6,0.4,3.4,1.3c0.8,0.9,1.3,2.2,1.3,3.8V30H20V13.8 C20,11.7,18.3,10,16.2,10z"/>
        </svg>
	</a>
    <div class="header-right">
        <ul id="usermenu">
        	<li onmouseover="Element.addClassName(this,'over')" onmouseout="Element.removeClassName(this,'over')" class="parent level0 usermenulabel">
        		<a href="#" onclick="return false" title="<?php echo $this->__('User Menu') ?>">
                    <svg version="1.1" id="burger" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
                        <rect opacity="0.25" fill="#FFFFFF" width="40" height="40"></rect>
                        <path fill="#FFFFFF" d="M31,21H9v-2h22V21z M31,17H9v-2h22V17z M31,25H9v-2h22V25z"></path>
                    </svg>
                </a>
			    <ul>
                    <li><a href="<?php echo Mage::helper("adminhtml")->getUrl("adminhtml/system_account"); ?>"><span><?php echo $this->__("Logged in as %s", $this->escapeHtml($this->getUser()->getUsername())); ?></span></a></li>
			    	<li><a href="<?php echo Mage::getBaseUrl();; ?>" target="_blank"><span><?php echo $this->__('View') . ': ' . $this->escapeHtml(Mage::app()->getStore()->getFrontendName()); ?></span></a></li>
			    	<li class="last"><a href="<?php echo $this->getLogoutLink() ?>"><span><?php echo $this->__('Log Out') ?></span></a></li>
		        </ul>
		    </li>
		</ul>
        <?php if (Mage::getStoreConfigFlag('admin/global_search/enable') && Mage::getSingleton('admin/session')->isAllowed('admin/global_search')): ?>
        <fieldset>
            <legend>Search</legend>
            <span id="global_search_indicator" class="autocomplete-indicator" style="display: none">
                <img src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" alt="<?php echo Mage::helper('core')->quoteEscape($this->__('Loading...')) ?>" class="v-middle"/>
            </span>
            <?php $defSearch = $this->__('Global Record Search') ?>
            <input id="global_search" name="query" type="text" class="input-text" value="<?php if(!empty($query)): ?><?php echo $query ?><?php else: ?><?php echo Mage::helper('core')->quoteEscape($defSearch) ?><?php endif ?>" onfocus="if(this.value=='<?php echo Mage::helper('core')->quoteEscape($defSearch, true) ?>')this.value=''; " onblur="if(this.value=='')this.value='<?php echo $defSearch ?>';" autocomplete="off" />
            <div id="global_search_autocomplete" class="autocomplete"></div>
            <script type="text/javascript">
                new Ajax.Autocompleter(
                    'global_search',
                    'global_search_autocomplete',
                    '<?php echo $this->getUrl('adminhtml/index/globalSearch') ?>',
                    {
                        paramName:"query",
                        minChars:2,
                        indicator:"global_search_indicator",
                        updateElement:getSelectionId,
                        evalJSON:'force'
                    }
                );
                function getSelectionId(li) {
                    location.href = li.getAttribute('url');
                }
            </script>
        </fieldset>
        <?php endif ?>
    </div>
</div>
